<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <link rel="stylesheet" href="/styles/09-动态加载数据.css" />
    </head>
    <body>
        <div id="app">
            <!-- 顶栏 -->
            <div class="header">
                <h1>Tlias智能学习辅助系统</h1>
                <a href="#">退出登录</a>
            </div>

            <!-- 搜索表单区域 -->
            <form class="search-form">
                <input
                    type="text"
                    name="name"
                    placeholder="姓名"
                    v-model="searchForm.name"
                />
                <select name="gender" v-model="searchForm.gender">
                    <option value="">性别</option>
                    <option value="1">男</option>
                    <option value="2">女</option>
                </select>
                <select name="job" v-model="searchForm.job">
                    <option value="">职位</option>
                    <option value="1">班主任</option>
                    <option value="2">讲师</option>
                    <option value="3">学工主管</option>
                    <option value="4">教研主管</option>
                    <option value="5">咨询师</option>
                </select>
                <button type="button" @click="search">查询</button>
                <button type="button" @click="clear">清空</button>
            </form>

            <table class="table table-striped table-bordered">
                <thead>
                    <tr>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>头像</th>
                        <th>职位</th>
                        <th>入职日期</th>
                        <th>最后操作时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(emp, index) in empList" :key="index">
                        <td>{{ emp.name }}</td>
                        <td>{{ emp.gender === 1 ? '男' : '女' }}</td>
                        <td>
                            <img
                                :src="emp.image"
                                alt="{{ emp.name }}"
                                class="avatar"
                            />
                        </td>

                        <!-- 基于v-if/v-else-if/v-else指令来展示职位这一列 -->
                        <td>
                            <span v-if="emp.job == '1'">班主任</span>
                            <span v-else-if="emp.job == '2'">讲师</span>
                            <span v-else-if="emp.job == '3'">学工主管</span>
                            <span v-else-if="emp.job == '4'">教研主管</span>
                            <span v-else-if="emp.job == '5'">咨询师</span>
                            <span v-else>其他</span>
                        </td>

                        <!-- 基于v-show指令来展示职位这一列 -->
                        <!-- 
                            <td>
                                <span v-show="emp.job === '1'">班主任</span>
                                <span v-show="emp.job === '2'">讲师</span>
                                <span v-show="emp.job === '3'">学工主管</span>
                                <span v-show="emp.job === '4'">教研主管</span>
                                <span v-show="emp.job === '5'">咨询师</span>
                            </td>
                        -->

                        <td>{{ emp.entrydate }}</td>
                        <td>{{ emp.updatetime }}</td>
                        <td class="btn-group">
                            <button class="edit">编辑</button>
                            <button class="delete">删除</button>
                        </td>
                    </tr>
                </tbody>
            </table>

            <!-- 页脚版权区域 -->
            <footer class="footer">
                <p class="company-name">江苏传智播客教育科技股份有限公司</p>
                <p class="copyright">
                    版权所有 Copyright 2006-2024 All Rights Reserved
                </p>
            </footer>
        </div>

        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
        <script src="/scripts/09-动态加载数据.js" type="module"></script>
    </body>
</html>
